/**
 * @author xiaobyu
 * @created Jun 16, 2016
 * 
 */
package mdt.model;

import java.util.ArrayList;
import java.util.List;

public class NodeModel extends MDTModel implements INodeModel{
	
	private static final long serialVersionUID = 1L;

	private String name;
	
	List<IEdgeModel> srcDependencies = new ArrayList<>();
	List<IEdgeModel> dstDependencies = new ArrayList<>();
	
	public NodeModel(String name) {
		this.name = name;
	}
	
	public void setName(String name) {
		this.name = name;
	}
	
	public String getName() {
		return name;
	}

	@Override
	public void addSrcDependency(IEdgeModel dep) {
		srcDependencies.add(dep);
	}

	@Override
	public void removeSrcDependency(IEdgeModel dep) {
		srcDependencies.remove(dep);
	}

	@Override
	public void addDstDependency(IEdgeModel dep) {
		dstDependencies.add(dep);
	}

	@Override
	public void removeDstDependency(IEdgeModel dep) {
		dstDependencies.remove(dep);
	}

	public String toString() {
		return "Node: " + name;
	}

	public Object clone() {
		NodeModel cloned = (NodeModel)super.clone();
		cloned.setName("copy of " + name);
		return cloned;
	}

	public INodeModel getConnectorOwner() {
		return this;
	}

	public IConnector connectorAt(int idx) {
		return this;
	}

}
